package com.xqboss.apps.mapper.consumer;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xqboss.apps.domain.consumer.ConsumerTeam;
import com.xqboss.apps.dto.consumer.ConsumerTeamDto;
import com.xqboss.apps.vo.consumer.ConsumerTeamDetailVo;
import com.xqboss.apps.vo.consumer.ConsumerTeamInfoVo;
import com.xqboss.apps.vo.consumer.ConsumerTeamVo;
import com.xqboss.apps.vo.punch.TeamPunchRecordVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * 队伍Mapper接口
 *
 * @author xqboss
 * @date 2023-08-15
 */
public interface ConsumerTeamMapper extends BaseMapper<ConsumerTeam> {
    /**
     * 查询队伍
     *
     * @param id 队伍主键
     * @return 队伍
     */
    public ConsumerTeam selectConsumerTeamById(Integer id);

    /**
     * 查询队伍列表
     *
     * @param consumerTeam 队伍
     * @return 队伍集合
     */
    public List<ConsumerTeam> selectConsumerTeamList(ConsumerTeam consumerTeam);

    /**
     * 新增队伍
     *
     * @param consumerTeam 队伍
     * @return 结果
     */
    public int insertConsumerTeam(ConsumerTeam consumerTeam);

    /**
     * 修改队伍
     *
     * @param consumerTeam 队伍
     * @return 结果
     */
    public int updateConsumerTeam(ConsumerTeam consumerTeam);

    /**
     * 删除队伍
     *
     * @param id 队伍主键
     * @return 结果
     */
    public int deleteConsumerTeamById(Long id);

    /**
     * 批量删除队伍
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteConsumerTeamByIds(Long[] ids);

    ConsumerTeamInfoVo getTeamMember(Integer teamId);

    int addMemberCount(@Param("teamId") Integer teamId, @Param("count") int count);

    int abatementMemberCount(@Param("teamId") Integer teamId, @Param("count") int count);

    List<ConsumerTeamVo> selectListVo(ConsumerTeamDto dto);

    ConsumerTeamVo getMyTeam(Long userId);

    /**
     * 获取队伍信息
     * @param teamId
     * @return
     */
    ConsumerTeamVo getTeamInfo(Long teamId);

    @InterceptorIgnore(blockAttack = "true")
    boolean cleanTeamPunchGain();

    ConsumerTeamVo getCurrentUserTeamRank(@Param("teamId") Long teamId,@Param("userId") Long userId);

    /**
     * 1.6.0版本，获取队伍信息
     *
     * @param teamId 队伍id
     * @return
     */
    ConsumerTeamDetailVo getTeamMemberNew(Long teamId);

}

